package router

import (
	"github.com/gin-gonic/gin"

	"mxshop-api/goods-web/api/brand"
	"mxshop-api/goods-web/global"
	"mxshop-api/shared/auth"
)

func InitBrandRouter(r *gin.RouterGroup) {
	signingKey := global.ServerConfig.SigningKey
	BrandRouter := r.Group("/brand")
	{
		BrandRouter.GET("", brand.List)
		BrandRouter.POST("", auth.Middleware(signingKey), auth.IsAdminUser(), brand.Create)
		BrandRouter.PUT("/:id", auth.Middleware(signingKey), auth.IsAdminUser(), brand.Update)
		BrandRouter.DELETE("/:id", auth.Middleware(signingKey), auth.IsAdminUser(), brand.Delete)
	}

	CategoryBrandRouter := r.Group("/category-brands")
	{
		CategoryBrandRouter.GET("", brand.CategoryBrandList)
		CategoryBrandRouter.GET("/:id", auth.Middleware(signingKey), auth.IsAdminUser(), brand.GetCategoryBrandList)
		CategoryBrandRouter.POST("", auth.Middleware(signingKey), auth.IsAdminUser(), brand.NewCategoryBrand)
		CategoryBrandRouter.PUT("/:id", auth.Middleware(signingKey), auth.IsAdminUser(), brand.UpdateCategoryBrand)
		CategoryBrandRouter.DELETE("/:id", auth.Middleware(signingKey), auth.IsAdminUser(), brand.DeleteCategoryBrand)
	}
}
